﻿﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-us">
<head>
    <title>首页</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="icon" href="favicon.ico" />
    <!--jquery库-->
    <script src="js/jquery.min.js"></script>
    <!--bootstrap库-->
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <script src="js/bootstrap/bootstrap.min.js"></script>
    <!--[if lt IE 9]>
    <script src="js/bootstrap/html5shiv.min.js"></script>
    <script src="js/bootstrap/respond.min.js"></script>
    <![endif]-->
    <!--font-awesome字体库-->
    <link href="css/font-awesome.min.css" rel="stylesheet" />
    <!--页面加载进度条-->
    <link href="css/pace/dataurl.css" rel="stylesheet" />
    <script src="js/pace/pace.min.js"></script>
    <!--jquery.hammer手势插件-->
    <script src="js/jquery.hammer/hammer.min.js"></script>
    <script src="js/jquery.hammer/jquery.hammer.js"></script>
    <!--平滑滚动到顶部库-->
    <script src="js/jquery.scrolltopcontrol/scrolltopcontrol.js" type="text/javascript"></script>
    <!--主要写的jquery拓展方法-->
    <script src="js/jquery.extend.js" type="text/javascript"></script>
    <!--主要写的css代码-->
    <link href="css/default.css" rel="stylesheet" type="text/css" />
    <!-- 动画效果-->
    <link href="css/animation.css" rel="stylesheet" type="text/css" />
    <!--主要写的js代码-->
    <script src="js/default.js" type="text/javascript"></script>
    <!-- jquery-easyui里的图标样式 -->
    <link rel="stylesheet" href="add-sample/easyui/themes/icon.css">
    <!-- jquery-easyui里的样式 -->
    <link rel="stylesheet" href="add-sample/easyui/themes/bootstrap/easyui.css">
    <!-- jquery的js -->
    <script type="text/javascript" src="add-sample/easyui/jquery.min.js"></script>
    <!-- jquery-easyui自己的js -->
    <script type="text/javascript" src="add-sample/easyui/jquery.easyui.min.js"></script>

    <script src="./js/jquery.md5.js"></script>

    <style>
        .headSpan{
            font-family:Arial;
            font-size:18px;
            font-weight:bold;

        }
        .maincontent {
            background: url('image/pcbg.jpg') no-repeat;
            background-position: center center;
            background-size: 100% 100%;
            overflow:hidden
        }
        .tabs-panels,.panel,.panel-body{
            height:100%;
            overflow:hidden}
        .tabs-title{
            font-family:Arial;
            font-size:15px;
        }

        #couponMenu,#sampleMenu,#reportMenu,#sampleReportMenu{
            background-color: #ef6767b3;
            background-color:rgba(239,103,103,0.7);
            display: none;
        }
        #couponMenu li,#sampleMenu li,#reportMenu li,#sampleReportMenu li{
            display: block;
            position: relative;
            padding-left: 20px;
            border: 0px;

        }
        #couponMenu li a ,#sampleMenu li a,#reportMenu li a,#sampleReportMenu li a{padding: 10px 15px;
            border-bottom: none;display: block;text-decoration: none;
        }

        /* #couponMenu li:hover,#couponMenu .activeLi{
            background-color:rgba(210,188,177,0.7);!*#e8a299;*!
             color:#fff;
             transform: scale(1.05);
             -webkit-transform: scale(1.05);
             font-weight: bold;
         }


         .animationFlip{animation: flipInX 3s ease-in-out 0s  1;  -webkit-animation: flipInX 3s ease-in-out 0s 1 ;
             -moz-animation: flipInX 3s ease-in-out 0s 1 ; !* Firefox *!-o-animation: flipInX 3s ease-in-out 0s 1;    !* Opera *!}*/

    </style>
</head>

<body style="overflow:hidden">
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle show pull-left" data-target="sidebar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"
                    aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">首页</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
                        <i class="fa fa-user fa-fw"></i>
                        <span class="username"></span>
                        <span class="caret"></span>
                    </a>
                    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                        <a class="dropdown-item" href="javascript:logout();">退出登录</a>
                    </div>
                </li>
            </ul>

            <ul class="nav navbar-nav navbar-right">
                <li>
                    <a href="javascript:openDiv()">修改密码</a>
                </li>
            </ul>
        </div>
    </div>
</nav>
<div class="zhezhao" style="position: fixed;position: fixed;left:0;top:0;bottom:0;right:0;background:#000;opacity:0.5;display: none;"></div>
<div class="alertPassword" style="width: 500px;height: 400px;border: 1px solid #ddd;border-radius: 5px;position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);background: #fff;display: none;">
    <h2 style="font-size: 24px;text-align: center">修改密码</h2>
    <div style="margin: 30px 0 0 30px">
        <span style="font-size: 18px">　旧密码：</span>
        <input type="password" class="beforPassWord" maxlength="16" style="border: 1px solid #ddd;border-radius: 3px;width: 180px;height: 30px;">
        <span style="color: red"  class="spanText1"></span>
    </div>
    <div style="margin: 30px 0 0 30px">
        <span style="font-size: 18px">　新密码：</span>
        <input type="password" class="passWord" maxlength="16" style="border: 1px solid #ddd;border-radius: 3px;width: 180px;height: 30px;">
        <span style="color: red" class="spanText2"></span>
    </div>
    <div style="margin: 30px 0 50px 30px">
        <span style="font-size: 18px">确认密码：</span>
        <input type="password" class="passWord2" maxlength="16" style="border: 1px solid #ddd;border-radius: 3px;width: 180px;height: 30px;">
        <span style="color: red" class="spanText3"></span>
    </div>
    <div style="width: 100%;text-align: center">
        <button class="doSubmit" style="width: 80px;height: 40px;background: #337ab7;color: #fff;border: 1px solid #337ab7;border-radius: 5px">提交</button>
        <button class="closeDiv" style="width: 80px;height: 40px;background: #337ab7;color: #fff;border: 1px solid #337ab7;border-radius: 5px;margin-left: 30px">关闭</button>
    </div>
</div>
<div class="container-fluid all">
    <div class="sidebar">
        <ul class="nav">
            <li>
                <a href="#">首页</a>
            </li>

            <c:set var="menuCodeFirst" value="${fn:split(loginUser.menuCodeFirst, ',')}" />
            <c:set var="menuCodeSecond" value="${fn:split(loginUser.menuCodeSecond, ',')}" />

            <c:forEach items="${menuCodeFirst}" var="first">
            <c:if test="${first == 'A0'}">
            <li class="has-sub">
                <a href="javascript:void (0)" onclick="showSubMenu(this,'couponMenu')">
                    <span>民生免费券</span>
                    <i class="fa fa-caret-right fa-fw pull-right"></i>
                </a>
            </li>
            </c:if>

            <c:if test="${first == 'A0'}">
            <ul id="couponMenu">
                <c:forEach items="${menuCodeSecond}" var="second">
                <c:if test="${second == 'A1'}">
                    <li>
                        <a  href="javascript:void(0)" onclick="addTab('免费券代申请','coupon-apply.html')">
                            <span>免费券代申请</span>
                        </a>
                    </li>
                </c:if>

                <c:if test="${second == 'A2'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('扫码枪扫码','pcqrCode.html')">
                            <span>扫码枪扫码</span>
                        </a>
                    </li>
                </c:if>

                <c:if test="${second == 'A3'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('免费券查看','coupon-show.html')">
                            <span>免费券查看</span>
                        </a>
                    </li>
                </c:if>

                <c:if test="${second == 'A4'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('免费券审核','coupon-review.html')">
                            <span>免费券审核</span>
                        </a>
                    </li>
                </c:if>
                </c:forEach>
            </ul>
            </c:if>

            <c:if test="${first == 'B0'}">
            <li class="has-sub">
                <a href="javascript:void(0)" onclick="showSubMenu(this,'sampleMenu')">
                    <span>送检单</span>
                    <i class="fa fa-caret-right fa-fw pull-right"></i>
                </a>
            </li>
            </c:if>

            <c:if test="${first == 'B0'}">
            <ul id="sampleMenu">
                <c:forEach items="${menuCodeSecond}" var="second">
                    <c:if test="${second == 'B1'}">
                    <li>
                        <a  href="javascript:void(0)" onclick="addTab('查看送检单','sample-list.html?operate=show')">
                            <span>查看送检单</span>
                        </a>
                    </li>
                    </c:if>
                    <c:if test="${second == 'B2'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('编辑送检单','sample-list.html?operate=edit')">
                            <span>编辑送检单</span>
                        </a>
                    </li>
                    </c:if>
                    <c:if test="${second == 'B3'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('删除送检单','sample-list.html?operate=delete')">
                            <span>删除送检单</span>
                        </a>
                    </li>
                    </c:if>
                    <c:if test="${second == 'B4'}">
                        <li>
                            <a href="javascript:void(0)" onclick="addTab('导出送检单','exportSample.html')">
                                <span>导出送检单</span>
                            </a>
                        </li>
                    </c:if>
                </c:forEach>
            </ul>
            </c:if>


            <c:if test="${first == 'C0'}">
            <li class="has-sub">
                <a href="javascript:void(0)" onclick="showSubMenu(this,'sampleReportMenu')">
                    <span>检测结果查询</span>
                    <i class="fa fa-caret-right fa-fw pull-right"></i>
                </a>
            </li>
            </c:if>
            <c:if test="${first == 'C0'}">
            <ul id="sampleReportMenu">
                <c:forEach items="${menuCodeSecond}" var="second">
                <c:if test="${second == 'C1'}">
                <li>
                    <a href="javascript:void(0)" onclick="addTab('结果查询','sampleReport.html')">
                        <span>结果查询</span>
                    </a>
                </li>
                </c:if>
                <c:if test="${second == 'C2'}">
                <li>
                    <a href="javascript:void(0)" onclick="addTab('报告查看','sample-report.html')">
                        <span>报告查看</span>
                    </a>
                </li>
                </c:if>
                <c:if test="${second == 'C3'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('新筛区县级','newbornCounty.html')">
                            <span>新筛区县级</span>
                        </a>
                    </li>
                    </c:if>
                    <c:if test="${second == 'C4'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('新筛医院级','newbornHospital.html')">
                            <span>新筛医院级</span>
                        </a>
                    </li>
                    </c:if>
                    <c:if test="${second == 'C5'}">
                        <li>
                            <a href="javascript:void(0)" onclick="addTab('产筛报告查看','chanshai-result-show.html')">
                                <span>产筛报告查看</span>
                            </a>
                        </li>
                    </c:if>
                </c:forEach>
            </ul>
            </c:if>







            <c:if test="${first == 'D0'}">
            <li class="has-sub">
                <a href="javascript:void(0)" onclick="showSubMenu(this,'reportMenu')">
                    <span>统计报表</span>
                    <i class="fa fa-caret-right fa-fw pull-right"></i>
                </a>
            </li>
            </c:if>
            <c:if test="${first == 'D0'}">
            <ul id="reportMenu">
                <c:forEach items="${menuCodeSecond}" var="second">
                <c:if test="${second == 'D1'}">
                <li>
                    <a href="javascript:void(0)" onclick="addTab('统计报表','/csfy/report/findReportTable.do')">
                        <span>统计报表（总）</span>
                    </a>
                </li>
                </c:if>
                <c:if test="${second == 'D2'}">
                <li>
                    <a href="javascript:void(0)" onclick="addTab('区县统计级','summary.html')">
                        <span>免费券--区县统计级</span>
                    </a>
                </li>
                </c:if>
                <c:if test="${second == 'D3'}">
                <li>
                    <a href="javascript:void(0)" onclick="addTab('区县详情','countyInfo.html')">
                        <span>免费券--区县详情</span>
                    </a>
                </li>
                </c:if>
                <c:if test="${second == 'D4'}">
                <li>
                    <a href="javascript:void(0)" onclick="addTab('医院级详情','hospitalAccount.html')">
                        <span>免费券--医院级详情</span>
                    </a>
                </li>
                </c:if>
                <c:if test="${second == 'D5'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('医院级','testReport.html')">
                            <span>免费券--医院级</span>
                        </a>
                    </li>
                </c:if>
                    <c:if test="${second == 'D6'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('街道使用统计','streetCoupons.html')">
                            <span>免费券--街道使用</span>
                        </a>
                    </li>
                </c:if>
                    <c:if test="${second == 'D7'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('机构扫码量','institutionsCoupons.html')">
                            <span>免费券--机构扫码量</span>
                        </a>
                    </li>
                </c:if>
                    <c:if test="${second == 'D8'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('机构样本统计','institutionSampleTotal.html')">
                            <span>机构样本接收量统计</span>
                        </a>
                    </li>
                </c:if>
                    <c:if test="${second == 'D9'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('区域样本统计','institutionsCountryTotal.html')">
                            <span>检测机构区域样本统计</span>
                        </a>
                    </li>
                </c:if>
                    <c:if test="${second == 'D11'}">
                    <li>
                        <a href="javascript:void(0)" onclick="addTab('机构检测量','institutionsTotal.html')">
                            <span>机构检测量统计</span>
                        </a>
                    </li>
                </c:if>
                </c:forEach>
            </ul>
            </c:if>


            <c:if test="${first == 'E0'}">
            <li class="has-sub">
                <a href="javascript:void(0)" onclick="addActiveTab('权限分配','power-manage.html',this)" >
                    <span>权限分配</span>
                    <i class="fa fa-caret-right fa-fw pull-right"></i>
                </a>
            </li>
            </c:if>
            </c:forEach>
            <!--<li class="has-sub">-->
            <!--<a href="screening.html">-->
            <!--<span>两癌筛查管理</span>-->
            <!--<i class="fa fa-caret-right fa-fw pull-right"></i>-->
            <!--</a>-->
            <!--</li>-->
            <!--<li class="has-sub">-->
            <!--<a href="importData.html">-->
            <!--<span>孕妇建册数据导入</span>-->
            <!--<i class="fa fa-caret-right fa-fw pull-right"></i>-->
            <!--</a>-->
            <!--</li>-->
        </ul>
    </div>
    <div class="maincontent row">
        <div id="tt" style="width:100%;height:100%;"></div>
    </div>
</div>
<a href="#top" id="goTop">
    <i class="fa fa-angle-up fa-3x"></i>
</a>
<script>
    //获取当前登录用户信息
    $(document).ready(function () {

        //显示tabs
        $('#tt').tabs({
            border : false,
            title : "选项卡",
            tabWidth:130,
            tabHeight:30,
            toolPosition:"left",
        });

        var content = '<iframe scrolling="auto" frameborder="0"  src="indexPhoto.html" style="width:100%;height:100%;"></iframe>';
        $('#tt').tabs('add',{
            title:"首页",
            content:content,
            closable:true
        });
        $.ajax({
                    method: 'POST',
                    url: '/csfy/intf.do',
                    data: { method: 'getLoginUserInfo' },
                    success: res => {
                    if (res.code == 10086) {
//                        window.location.href = "/csfy/index.do"
            alert("请重新登录！");
        } else {
            if (res.code == 200) {
                $(".username").html(res.rows.userName);
            }
        }
    }
    })
    })
    var beforPassWord = "";
    var userId = "";
    //弹出修改密码窗口
    function openDiv() {
        $(".zhezhao").show();
        $(".alertPassword").show();
        $.ajax({
                    method: 'POST',
                    url: '/csfy/user/getUserPsw.do',
                    success: res => {
                    var res = JSON.parse(res);
        if (res.code == 200) {
            userId = res.rows.userId;
            beforPassWord = res.rows.userPwd;
        }
    }
    })
    }
    //关闭修改密码窗口
    $(".closeDiv").click(function () {
        $(".zhezhao").hide();
        $(".alertPassword").hide();
        $(".beforPassWord").val('');
        $(".passWord").val('');
        $(".passWord2").val('');
    })
    //失去焦点校验
    $(".beforPassWord").blur(function () {
        if($.md5($(".beforPassWord").val()).toUpperCase() != beforPassWord){
            $(".spanText1").text("旧密码输入不正确！");
        }else {
            $(".spanText1").text("");
        }
    })
    $(".passWord").blur(function () {
        if($(".passWord").val().length < 6 || $(".passWord").val().length > 16){
            $(".spanText2").text("密码长度必须为6~16位！");
        }else {
            $(".spanText2").text("");
        }
    })
    $(".passWord2").blur(function () {
        if($(".passWord").val() != $(".passWord2").val()){
            $(".spanText3").text("两次输入的新密码不一样！");
        }else {
            $(".spanText3").text("");
        }
    })
    //提交修改密码
    $(".doSubmit").click(function () {
        if($.md5($(".beforPassWord").val()).toUpperCase() != beforPassWord){
            $(".spanText1").text("旧密码输入不正确！");
            return false;
        }
        if($(".passWord").val().length < 6 || $(".passWord").val().length > 16){
            $(".spanText2").text("密码长度必须为6~16位！");
            return false;
        }
        if($(".passWord").val() != $(".passWord2").val()){
            $(".spanText3").text("两次输入的新密码不一样！");
            return false;
        }
        var postData = {
            userId:userId,
            userMd5Pwd:$(".passWord").val()
        }
        $.ajax({
                    method: 'POST',
                    url: '/csfy/user/updateUamsUserPsw.do',
                    data: postData,
                    success: res => {
                    var res = JSON.parse(res);
        if (res.code == 200) {
            alert("修改密码成功！");
            logout();
        }
    }
    })
    })

    //退出登录
    function logout() {
        $.ajax({
            url: '/csfy/dologout.do',
            method: 'POST',
            success: function (res) {
                if (JSON.parse(res).code == 200) {
                    window.location.href = "/csfy/index.do"
                }
            }
        })
    }
    $(".maincontent").height($(window).height() - 50);
    $(window).resize(function(){
        $(".maincontent").height($(window).height() - 50);
    })

    sessionStorage.removeItem("sampleEditSuccess");
    //动态添加标签页
    function addTab(title, url) {
        if ($('#tt').tabs('exists', title)) {
            $('#tt').tabs('select', title);
        } else {
            var content = '<iframe scrolling="auto" id ="' + url + '" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
            $('#tt').tabs('add', {
                title: title,
                content: content,
                closable: true
            });

        }
        //判断民生免费券二级菜单是否显示
        var isCoupon=url.indexOf("coupon");
        var isPcqrCode = url.indexOf("pcqrCode");
        if(isCoupon == -1 && isPcqrCode == -1){
            //$("#couponMain").removeClass("active");
            $("#couponMenu").hide();
            //$("#couponMenu li").removeClass("animationFlip activeLi");
        }
    }

    //显示二级菜单，添加当前样式
    function showSubMenu(obj,str){
        $(obj).parent().addClass("active");
        $(obj).parent().siblings("li").removeClass("active");
        var isShow=$("#"+str).css("display");
        var menuList = ['couponMenu','sampleMenu','reportMenu','sampleReportMenu'];
        if(isShow == "none"){
            for(var i in menuList){
                if(str == menuList[i]){
                    $("#"+menuList[i]).show();
                }else{
                    $("#"+menuList[i]).hide();
                }
            }
            //$("#couponMenu li").addClass("animationFlip");
        }else {
            for(var i in menuList){
                    $("#"+menuList[i]).hide();
                }
            }
            //$("#couponMenu li").removeClass("animationFlip");
        }

    //一级菜单打开tabs，并添加当前（激活）样式
    function addActiveTab(title, url,obj) {
        if ($('#tt').tabs('exists', title)) {
            $('#tt').tabs('select', title);
        } else {
            var content = '<iframe scrolling="auto" id ="' + url + '" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
            $('#tt').tabs('add', {
                title: title,
                content: content,
                closable: true
            });

        }
        $("#couponMenu").hide();
        $("#sampleMenu").hide();
        $("#reportMenu").hide();
        $("#sampleReportMenu").hide();
        $(obj).parent().addClass("active");
        $(obj).parent().siblings("li").removeClass("active");
    }
</script>
</body>
</html>